Preliminaries

#install.packages("knitr")
library(knitr)
knitr::opts_knit$set(root.dir = "/Users/floriangoldinger/Desktop/Unilu/Forecasting in Economics and Business/Forecasting Project")
knitr::opts_chunk$set(message = FALSE,warning=FALSE)
 rm(list = ls())

Install and load packages

#install.packages("tseries")  
#install.packages("xts") 
#install.packages("forecast") 
#install.packages("tsbox")    
#install.packages("seasonal")
#install.packages("mFilter")
#install.packages("bruceR", dep=TRUE)
#install.packages("fanplot")

library(tseries)  
library(xts)
library(forecast) 
library(tsbox)    
library(seasonal)
library(mFilter)
library(dplyr)
library(readxl)
library(vars)
library(MASS)
library(bruceR)
library(fanplot)  

Prepare and transform data

Load data:

rawData <- read_excel("retail_sales_transp_March.xlsx")

Convert the data frame to a xts object and use the first column as date:

data <- as.xts(x = rawData[, -1], order.by = as.Date(rawData$Date))

Take the first difference of the log to later work with the growth rates :

data$df_Retail_sales <- diff(log(data$Retail_sales), lag = 1, differences = 1)
data$df_Inflation <- diff(log(data$Inflation), lag = 1, differences = 1)
data$df12_Retail_sales <- diff(log(data$Retail_sales), lag = 12, differences = 1)
data$df_CHFEUR <- diff(log(data$CHFEUR), lag = 1, differences = 1)
data$df_Unemploy <- diff(log(data$Unemploy), lag = 1, differences = 1)
data$df_Brent_COIL <- diff(log(data$Brent_COIL), lag = 1, differences = 1)
data$df_Retail_EU <- diff(log(data$Retail_sales_EU), lag = 1, differences = 1)

Delete first row because of differencing

data <- tail(data, -1)

Visualize data

plot.xts(cbind(data$Retail_sales),  main = "Retail Sales Index (not seasonally adjusted)")

plot.xts(cbind(data$df_Retail_sales),  main = "Retail Sales Growth rate (not seasonally adjusted)")

plot.xts(cbind(data$Retail_sales_EU),  main = "Retail Sales EU")

plot.xts(cbind(data$df_Retail_sales),  main = "Retail Sales Growth rate (not seasonally adjusted)")

plot.xts(cbind(data$CHFEUR),  main = "CHF/EUR")

plot.xts(cbind(data$Inflation),  main = "Inflation")

plot.xts(cbind(data$Brent_COIL),  main = "Brent Crude Oil")

Seasonally adjust df Retail sales and df Retail Sales EU with monthly dummies.

monthlyDummies <- forecast::seasonaldummy(ts_ts(data$df_Retail_sales)) 
modelretailseasonch <- lm(data$df_Retail_sales ~ monthlyDummies)
plot.xts(as.xts(modelretailseasonch$fitted.values),  main = "Swiss Retail Sales: fitted with seasonal dummy")

plot.xts(as.xts(modelretailseasonch$residuals),  main = "Swiss Retail Sales: deviations from seasonal dummy")

data$Retail_sales_cycle  <- modelretailseasonch$residuals

modelretailseasoneu <- lm(data$df_Retail_EU ~ monthlyDummies)
plot.xts(as.xts(modelretailseasoneu$fitted.values),  main = "EU Retail Sales: fitted with seasonal dummy")

plot.xts(as.xts(modelretailseasoneu$residuals),  main = "EU Retail Sales: deviations from seasonal dummy")

data$Retail_EU_cycle <- modelretailseasoneu$residuals

Create pandemic dummies to later exclude this period from analysis - suggesting a pandemic period from 01/01/2020 to 31/21/2021.

pandemicDummies <- as.xts(ts(matrix(0, nrow = 320, ncol = 24), start = c(2000, 2), frequency = 12))
pandemicDummies["2020-01-01", 1] <- 1
pandemicDummies["2020-02-01", 2] <- 1
pandemicDummies["2020-03-01", 3] <- 1
pandemicDummies["2020-04-01", 4] <- 1
pandemicDummies["2020-05-01", 5] <- 1
pandemicDummies["2020-06-01", 6] <- 1
pandemicDummies["2020-07-01", 7] <- 1
pandemicDummies["2020-08-01", 8] <- 1
pandemicDummies["2020-09-01", 9] <- 1
pandemicDummies["2020-10-01", 10] <- 1
pandemicDummies["2020-11-01", 11] <- 1
pandemicDummies["2020-12-01", 12] <- 1
pandemicDummies["2021-01-01", 13] <- 1
pandemicDummies["2021-02-01", 14] <- 1
pandemicDummies["2021-03-01", 15] <- 1
pandemicDummies["2021-04-01", 16] <- 1
pandemicDummies["2021-05-01", 17] <- 1
pandemicDummies["2021-06-01", 18] <- 1
pandemicDummies["2021-07-01", 19] <- 1
pandemicDummies["2021-08-01", 20] <- 1
pandemicDummies["2021-09-01", 21] <- 1
pandemicDummies["2021-10-01", 22] <- 1
pandemicDummies["2021-11-01", 23] <- 1
pandemicDummies["2021-12-01", 24] <- 1

Univariate model

ACF and PACF graphs to determine AC and MA lag

par(mfrow=c(1,2))
acf(data$Retail_sales_cycle,lag.max = 20, na.action = na.contiguous,  main = "Inclusive Pandemic")
acf(data["/2019-12-01"]$Retail_sales_cycle,lag.max = 20, na.action = na.contiguous,  main = "Exclusive Pandemic")

par(mfrow=c(1,2))

pacf(data$Retail_sales_cycle,lag.max = 20,na.action = na.contiguous,  main = "Inclusive Pandemic")
pacf(data["/2019-12-01"]$Retail_sales_cycle,lag.max = 20,na.action = na.contiguous,  main = "Exclusive Pandemic")

When excluding the pandemic period and thereafter: ACF/PACF suggests including 2 AC and 1 MA term Still some seasonality (non deterministic) - include a SARIMA model in a later stage?

Arima

Check with Arima (2,0,1) as suggested by AC and ACF including pandemic dummies - BIC of -1312.4

forecast::Arima(data$Retail_sales_cycle,
          xreg = pandemicDummies["2000-02-01/2024-03-01"], 
          order = c(3L, 0L, 0L))
Series: data$Retail_sales_cycle 
Regression with ARIMA(3,0,0) errors 

Coefficients:
          ar1      ar2      ar3  intercept  Series 1  Series 2  Series 3  Series 4  Series 5  Series 6  Series 7
      -0.5892  -0.3997  -0.1062     -1e-04   -0.0182    0.0036   -0.0593   -0.1357    0.2514    0.0167   -0.0220
s.e.   0.0588   0.0643   0.0600      6e-04    0.0190    0.0220    0.0221    0.0222    0.0222    0.0223    0.0223
      Series 8  Series 9  Series 10  Series 11  Series 12  Series 13  Series 14  Series 15  Series 16  Series 17
       -0.0170   -0.0306     0.0457    -0.0113     0.0142    -0.0828    -0.0548     0.2231    -0.0235    -0.0474
s.e.    0.0223    0.0223     0.0223     0.0223     0.0223     0.0223     0.0223     0.0223     0.0223     0.0223
      Series 18  Series 19  Series 20  Series 21  Series 22  Series 23  Series 24
        -0.0018    -0.0481     0.0121    -0.0134     0.0414     0.0130    -0.0389
s.e.     0.0223     0.0223     0.0222     0.0223     0.0221     0.0221     0.0191

sigma^2 = 0.0003974:  log likelihood = 738.41
AIC=-1418.83   AICc=-1412.14   BIC=-1312.4

Arima different lags

We check for the best AIC and MIC with different lags. Now a bigger model is chosen ARIMA(3,0,3) with the BIC information criterion. BIC -1337.453 but only minor improvement to more simple model.


nArOrder <- 4
nMaOrder <- 4 
matrixAIC <- matrix(data = NA,nArOrder+1,nMaOrder+1)
matrixBIC <- matrix(data = NA,nArOrder+1,nMaOrder+1)

for(iArOrder in 0:nArOrder){ 
  for(iMaOrder in 0:nMaOrder){
    temp = forecast::Arima(data$Retail_sales_cycle, 
                           order = c(iArOrder,0,iMaOrder), 
                           xreg = pandemicDummies["2000-01-01/2024-03-01"])
    print(iArOrder)
    print(iMaOrder)
    print(temp$bic)
    print(-2*temp$loglik + (iArOrder+iMaOrder)*log(length(data$Retail_sales_cycle)))
    matrixAIC[iArOrder+1,iMaOrder+1] = temp$aic
    matrixBIC[iArOrder+1,iMaOrder+1] = temp$bic
  }
}
[1] 0
[1] 0
[1] -1237.047
[1] -1384.464
[1] 0
[1] 1
[1] -1334.733
[1] -1482.15
[1] 0
[1] 2
[1] -1332.314
[1] -1479.731
[1] 0
[1] 3
[1] -1326.776
[1] -1474.193
[1] 0
[1] 4
[1] -1326.1
[1] -1473.517
[1] 1
[1] 0
[1] -1285.445
[1] -1432.862
[1] 1
[1] 1
[1] -1332.206
[1] -1479.623
[1] 1
[1] 2
[1] -1330.254
[1] -1477.671
[1] 1
[1] 3
[1] -1324.617
[1] -1472.034
[1] 1
[1] 4
[1] -1321.264
[1] -1468.681
[1] 2
[1] 0
[1] -1314.956
[1] -1462.373
[1] 2
[1] 1
[1] -1326.542
[1] -1473.959
[1] 2
[1] 2
[1] -1324.631
[1] -1472.048
[1] 2
[1] 3
[1] -1328.438
[1] -1475.855
[1] 2
[1] 4
[1] -1315.749
[1] -1463.166
[1] 3
[1] 0
[1] -1312.403
[1] -1459.82
[1] 3
[1] 1
[1] -1323.729
[1] -1471.146
[1] 3
[1] 2
[1] -1321.328
[1] -1468.745
[1] 3
[1] 3
[1] -1337.453
[1] -1484.87
[1] 3
[1] 4
[1] -1321.816
[1] -1469.233
[1] 4
[1] 0
[1] -1312.918
[1] -1460.335
[1] 4
[1] 1
[1] -1319.434
[1] -1466.851
[1] 4
[1] 2
[1] -1329.688
[1] -1477.105
[1] 4
[1] 3
[1] -1336.848
[1] -1484.264
[1] 4
[1] 4
[1] -1326.605
[1] -1474.022
which(matrixBIC==min(matrixBIC), arr.ind = TRUE)
     row col
[1,]   4   4
which(matrixAIC==min(matrixAIC), arr.ind = TRUE)
     row col
[1,]   5   4

Auto Arima

A lower BIC with the SARIMA model, which is not surprising as the AC and PAC still showed high seasonality with lag 12. A model SARIMA(0,0,1)(2,1,1)[12] is suggested by Auto Arima. We will use the SARIMA model also in the later steps to account for the seasonality as the BIC is lower: -1403.98.

modelretailsales <- forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = pandemicDummies["2000-02-01/2024-03-01"], 
                     max.p = 4,
                     max.q = 4,
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1165.699
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1160.084
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1199.317
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1193.737
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1195.197
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1189.62
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1192.165
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1186.557
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1192.29
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1186.684
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1190.37
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1184.774
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1192.225
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1186.609
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1198.246
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1192.63
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1192.662
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1187.045
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1292.629
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1287.25
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1319.249
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1314.206
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1314.363
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1309.361
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1314.58
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1309.197
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1316.093
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1310.703
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1311.075
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1305.735
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1316.705
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1311.188
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1321.321
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1315.86
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1315.736
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1310.275
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1291.643
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1286.174
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1316.648
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1311.452
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1311.429
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1306.258
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1313.365
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1307.918
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1314.274
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1308.797
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1308.918
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1303.471
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1314.404
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1308.839
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1317.902
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1312.371
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1287.586
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1282.077
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1312.299
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1307.014
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1306.989
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1301.723
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1309.465
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1303.983
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1309.945
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1304.431
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1309.76
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1304.175
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1284.462
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1279.048
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1308.025
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1302.835
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1305.582
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1300.14
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1244.186
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1238.592
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1273.124
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1267.586
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1268.134
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1262.598
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1269.709
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1264.122
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1268.933
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1263.336
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1265.303
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1259.722
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1271.303
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1265.681
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1274.692
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1269.066
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1269.065
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1263.439
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1290.104
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1284.632
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1316.296
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1311.075
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1311.126
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1305.926
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1313.235
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1307.759
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1313.265
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1307.76
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1308.308
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1302.844
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1316.582
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1310.971
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1315.361
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1309.741
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1286.813
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1281.266
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1312.485
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1307.117
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1307.136
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1301.783
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1310.472
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1304.916
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1309.195
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1303.636
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1311.459
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1305.837
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1282.349
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1276.833
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1307.316
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1301.988
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1304.841
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1299.32
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1285.071
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1279.594
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1283.537
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1277.99
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1307.619
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1302.184
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1302.361
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1296.928
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1304.688
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1299.157
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1307.72
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1302.156
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1302.129
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1296.571
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1308.008
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1302.384
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1307.954
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1302.326
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1287.616
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1282.099
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1311.621
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1306.304
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1306.288
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1300.984
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1308.739
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1303.237
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1310.394
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1304.873
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1313.485
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1307.866
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1282.018
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1276.496
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1306.123
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1300.832
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1303.16
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1297.654
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1283.022
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1277.578
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1292.77
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1287.188
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1317.838
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1312.338
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1312.225
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1306.726
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1313.797
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1308.246
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1310.192
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1304.627
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1314.559
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1308.941
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1287.26
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1281.676
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1313.767
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1308.255
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1311.472
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1305.854
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1281.844
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1276.253
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1286.682
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1281.083
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1312.866
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1307.335
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1310.272
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1304.676
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1282.119
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1276.519

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(2,1,1)[12] errors 

We generate the forecast for the next 12 months based on the SARIMA(0,0,1)(1,0,1)[12] model.

monthlyDummiesForecast <- forecast::seasonaldummy(ts_ts(data$Retail_sales), 12) 

forecastretail <- forecast::forecast(modelretailsales, 
                                     xreg = pandemicDummies["2024-04-01/2025-03-01"])
par(mfrow = c(1, 1))
plot(forecastretail, main = "Exclusive pandemic: SARIMA(0,0,1)(1,0,1)")
grid(nx = NULL, ny = NULL, lty = 3, col = "gray", lwd = 0.1)

Multivariate model

Explore the CCF Plot for different candidates for the exogenous variable.Cross-correlation only found for Retail EU (seasonally adjusted) - nothing for CHFEUR, Inflation, Brent_COIL or Unemployment. We will assess if model can be improved by including Retail EU sales as exogenous variable.

ccf(as.ts(data$Retail_sales_cycle["/2019-12-31"]),as.ts(data$Retail_EU_cycle["/2019-12-31"]))

ccf(as.ts(data$Retail_sales_cycle["/2019-12-31"]),as.ts(data$df_CHFEUR["/2019-12-31"]))

ccf(as.ts(data$Retail_sales_cycle["/2019-12-31"]),as.ts(data$df_Inflation["/2019-12-31"]))

ccf(as.ts(data$Retail_sales_cycle["/2019-12-31"]),as.ts(data$df_Brent_COIL["/2019-12-31"]))

ccf(as.ts(data$Retail_sales_cycle["/2019-12-31"]),as.ts(data$df_Unemploy["/2019-12-31"]))

We double check the findings by modeling all the combinations and the related BIC values. Results: Univariate -1403.98 Multivariate Retail EU -1429.2 Retail EU with 1 lag -1418.18 CHF/EUR -1401.32 Retail EU AND CHF/EUR -1425.24

Model with Retail EU (Lag 0) with lowest BIC and significant coefficient. Combined Retail EU and CHF/EUR with significant coefficient for CHF/EUR but no improvement in BIC. We decided to not include it in the forecast model because only low significance and we prefer a simple model.

forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = pandemicDummies["2000-02-01/2024-03-01"],
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1165.699
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1160.084
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1199.317
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1193.737
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1195.197
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1189.62
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1192.165
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1186.557
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1192.29
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1186.684
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1190.37
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1184.774
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1192.225
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1186.609
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1198.246
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1192.63
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1192.662
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1187.045
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1292.629
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1287.25
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1319.249
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1314.206
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1314.363
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1309.361
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1314.58
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1309.197
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1316.093
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1310.703
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1311.075
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1305.735
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1316.705
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1311.188
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1321.321
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1315.86
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1315.736
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1310.275
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1291.643
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1286.174
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1316.648
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1311.452
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1311.429
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1306.258
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1313.365
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1307.918
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1314.274
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1308.797
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1308.918
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1303.471
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1314.404
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1308.839
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1317.902
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1312.371
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1287.586
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1282.077
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1312.299
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1307.014
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1306.989
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1301.723
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1309.465
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1303.983
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1309.945
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1304.431
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1309.76
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1304.175
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1284.462
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1279.048
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1308.025
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1302.835
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1305.582
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1300.14
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1280.486
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1275.18
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1244.186
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1238.592
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1273.124
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1267.586
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1268.134
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1262.598
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1269.709
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1264.122
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1268.933
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1263.336
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1265.303
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1259.722
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1271.303
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1265.681
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1274.692
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1269.066
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1269.065
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1263.439
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1290.104
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1284.632
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1316.296
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1311.075
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1311.126
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1305.926
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1313.235
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1307.759
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1313.265
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1307.76
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1308.308
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1302.844
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1316.582
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1310.971
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1315.361
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1309.741
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1286.813
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1281.266
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1312.485
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1307.117
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1307.136
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1301.783
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1310.472
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1304.916
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1309.195
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1303.636
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1311.459
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1305.837
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1282.349
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1276.833
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1307.316
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1301.988
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1304.841
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1299.32
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1285.071
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1279.594
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1283.537
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1277.99
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1307.619
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1302.184
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1302.361
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1296.928
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1304.688
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1299.157
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1307.72
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1302.156
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1302.129
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1296.571
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1308.008
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1302.384
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1307.954
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1302.326
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1287.616
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1282.099
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1311.621
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1306.304
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1306.288
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1300.984
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1308.739
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1303.237
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1310.394
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1304.873
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1313.485
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1307.866
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1282.018
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1276.496
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1306.123
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1300.832
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1303.16
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1297.654
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1283.022
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1277.578
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1292.77
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1287.188
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1317.838
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1312.338
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1312.225
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1306.726
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1313.797
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1308.246
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1310.192
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1304.627
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1314.559
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1308.941
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1287.26
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1281.676
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1313.767
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1308.255
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1311.472
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1305.854
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1281.844
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1276.253
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1286.682
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1281.083
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1312.866
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1307.335
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1310.272
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1304.676
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1282.119
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1276.519
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1282.59
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1277.037

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(2,1,1)[12] errors 

Series: ts_ts(data$df_Retail_sales) 
Regression with ARIMA(0,0,1)(2,1,1)[12] errors 

Coefficients:
          ma1    sar1    sar2     sma1  Series 1  Series 2  Series 3  Series 4  Series 5  Series 6  Series 7  Series 8
      -0.7075  0.2028  0.0362  -0.5787   -0.0002    0.0035   -0.0806   -0.1318    0.2678   -0.0242    0.0067   -0.0105
s.e.   0.0415  0.1969  0.1015   0.1863    0.0129    0.0156    0.0156    0.0158    0.0158    0.0157    0.0157    0.0157
      Series 9  Series 10  Series 11  Series 12  Series 13  Series 14  Series 15  Series 16  Series 17  Series 18
       -0.0174     0.0381    -0.0297     0.0348    -0.0665    -0.0620     0.1984    -0.0107    -0.0371    -0.0365
s.e.    0.0157     0.0157     0.0157     0.0154     0.0154     0.0156     0.0157     0.0157     0.0157     0.0158
      Series 19  Series 20  Series 21  Series 22  Series 23  Series 24
        -0.0177     0.0146    -0.0017     0.0364    -0.0040    -0.0086
s.e.     0.0158     0.0157     0.0157     0.0157     0.0157     0.0130

sigma^2 = 0.0002296:  log likelihood = 783.59
AIC=-1509.18   AICc=-1502.16   BIC=-1403.98
forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$df_Retail_EU),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1186.405
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1180.785
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1221.354
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1215.739
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1216.148
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1210.534
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1222.289
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1216.676
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1221.957
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1216.341
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1217.901
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1212.287
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1219.63
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1214.003
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1219.999
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1214.373
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1214.476
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1208.85
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1312.424
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1306.889
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1341.664
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1336.138
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1336.24
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1330.72
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1336.113
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1330.565
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1336.828
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1331.267
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1331.487
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1325.935
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1341.735
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1336.11
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1341.534
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1335.916
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1336.256
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1330.635
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1311.167
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1305.599
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1339.729
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1334.172
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1334.136
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1328.58
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1335.577
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1330.019
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1336.006
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1330.423
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1330.405
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1324.826
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1339.765
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1334.142
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1339.078
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1333.467
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1306.639
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1301.058
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1335.128
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1329.558
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1329.536
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1323.967
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1331.933
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1326.369
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1332.58
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1326.987
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1335.317
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1329.696
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1303.797
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1298.253
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1330.239
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1324.684
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1327.128
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1321.568
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1299.658
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1294.144
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1265.476
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1259.862
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1298.491
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1292.875
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1292.886
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1287.27
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1299.829
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1294.212
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1298.197
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1292.573
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1292.848
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1287.225
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1298.173
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1292.556
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1294.727
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1289.117
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1289.169
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1283.559
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1309.445
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1303.873
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1338.685
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1333.111
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1333.106
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1327.534
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1338.349
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1332.737
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1337.459
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1331.833
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1332.12
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1326.497
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1340.752
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1335.173
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1336.123
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1330.561
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1305.582
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1299.984
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1334.741
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1329.14
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1329.128
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1323.527
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1338.046
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1332.453
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1334.737
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1329.14
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1335.381
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1329.809
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1301.068
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1295.476
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1329.491
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1323.904
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1334.848
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1329.297
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1301.224
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1295.597
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1303.643
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1298.05
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1330.657
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1325.067
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1325.053
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1319.463
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1330.794
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1325.196
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1332.41
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1326.788
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1326.782
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1321.161
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1333.98
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1328.384
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1329.824
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1324.245
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1306.409
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1300.824
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1333.494
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1327.923
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1327.917
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1322.347
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1332.714
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1327.113
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1333.814
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1328.196
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1338.208
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1332.617
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1300.783
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1295.198
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1328.112
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1322.546
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1327.122
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1321.521
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1305.589
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1300.296
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1311.23
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1305.612
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1339.867
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1334.246
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1334.299
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1328.677
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1339.041
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1333.42
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1334.709
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1329.083
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1339.28
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1333.672
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1305.602
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1299.985
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1335.307
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1329.68
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1337.655
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1332.075
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1300.103
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1294.485
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1304.931
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1299.308
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1334.141
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1328.514
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1336.269
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1330.643
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1299.898
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1294.273
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1301.005
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1295.405

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(2,1,0)[12] errors 

Series: ts_ts(data$df_Retail_sales) 
Regression with ARIMA(0,0,1)(2,1,0)[12] errors 

Coefficients:
          ma1     sar1     sar2  Series.1  Series.2  Series.3  Series.4  Series.5  Series.6  Series.7  Series.8
      -0.6918  -0.3740  -0.1011   -0.0004   -0.0078   -0.1059   -0.1051    0.2543   -0.0090    0.0092   -0.0233
s.e.   0.0406   0.0636   0.0671    0.0119    0.0145    0.0150    0.0155    0.0148    0.0147    0.0145    0.0146
      Series.9  Series.10  Series.11  Series.12  Series.13  Series.14  Series.15  Series.16  Series.17  Series.18
       -0.0094     0.0243    -0.0229     0.0222    -0.0637    -0.0642     0.1923    -0.0080    -0.0342    -0.0305
s.e.    0.0145     0.0146     0.0145     0.0145     0.0142     0.0144     0.0144     0.0144     0.0144     0.0146
      Series.19  Series.20  Series.21  Series.22  Series.23  Series.24  df_Retail_EU
        -0.0120     0.0137    -0.0018     0.0286    -0.0068    -0.0101        0.4563
s.e.     0.0145     0.0144     0.0145     0.0145     0.0144     0.0120        0.0834

sigma^2 = 0.00021:  log likelihood = 796.2
AIC=-1534.41   AICc=-1527.39   BIC=-1429.2
forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$df_Retail_EU,
                                  lag(data$df_Retail_EU)
                     ),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1174.741
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1169.119
 ARIMA(0,0,0)(0,1,1)[12]                    : Inf
 ARIMA(0,0,0)(0,1,1)[12] with drift         : Inf
 ARIMA(0,0,0)(0,1,2)[12]                    : Inf
 ARIMA(0,0,0)(0,1,2)[12] with drift         : Inf
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1212.087
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1206.462
 ARIMA(0,0,0)(1,1,1)[12]                    : Inf
 ARIMA(0,0,0)(1,1,1)[12] with drift         : Inf
 ARIMA(0,0,0)(1,1,2)[12]                    : Inf
 ARIMA(0,0,0)(1,1,2)[12] with drift         : Inf
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1210.4
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1204.782
 ARIMA(0,0,0)(2,1,1)[12]                    : Inf
 ARIMA(0,0,0)(2,1,1)[12] with drift         : Inf
 ARIMA(0,0,0)(2,1,2)[12]                    : Inf
 ARIMA(0,0,0)(2,1,2)[12] with drift         : Inf
 ARIMA(0,0,1)(0,1,0)[12]                    : Inf
 ARIMA(0,0,1)(0,1,0)[12] with drift         : Inf
 ARIMA(0,0,1)(0,1,1)[12]                    : Inf
 ARIMA(0,0,1)(0,1,1)[12] with drift         : Inf
 ARIMA(0,0,1)(0,1,2)[12]                    : Inf
 ARIMA(0,0,1)(0,1,2)[12] with drift         : Inf
 ARIMA(0,0,1)(1,1,0)[12]                    : Inf
 ARIMA(0,0,1)(1,1,0)[12] with drift         : Inf
 ARIMA(0,0,1)(1,1,1)[12]                    : Inf
 ARIMA(0,0,1)(1,1,1)[12] with drift         : Inf
 ARIMA(0,0,1)(1,1,2)[12]                    : Inf
 ARIMA(0,0,1)(1,1,2)[12] with drift         : Inf
 ARIMA(0,0,1)(2,1,0)[12]                    : Inf
 ARIMA(0,0,1)(2,1,0)[12] with drift         : Inf
 ARIMA(0,0,1)(2,1,1)[12]                    : Inf
 ARIMA(0,0,1)(2,1,1)[12] with drift         : Inf
 ARIMA(0,0,1)(2,1,2)[12]                    : Inf
 ARIMA(0,0,1)(2,1,2)[12] with drift         : Inf
 ARIMA(0,0,2)(0,1,0)[12]                    : Inf
 ARIMA(0,0,2)(0,1,0)[12] with drift         : Inf
 ARIMA(0,0,2)(0,1,1)[12]                    : Inf
 ARIMA(0,0,2)(0,1,1)[12] with drift         : Inf
 ARIMA(0,0,2)(0,1,2)[12]                    : Inf
 ARIMA(0,0,2)(0,1,2)[12] with drift         : Inf
 ARIMA(0,0,2)(1,1,0)[12]                    : Inf
 ARIMA(0,0,2)(1,1,0)[12] with drift         : Inf
 ARIMA(0,0,2)(1,1,1)[12]                    : Inf
 ARIMA(0,0,2)(1,1,1)[12] with drift         : Inf
 ARIMA(0,0,2)(1,1,2)[12]                    : Inf
 ARIMA(0,0,2)(1,1,2)[12] with drift         : Inf
 ARIMA(0,0,2)(2,1,0)[12]                    : Inf
 ARIMA(0,0,2)(2,1,0)[12] with drift         : Inf
 ARIMA(0,0,2)(2,1,1)[12]                    : Inf
 ARIMA(0,0,2)(2,1,1)[12] with drift         : Inf
 ARIMA(0,0,3)(0,1,0)[12]                    : Inf
 ARIMA(0,0,3)(0,1,0)[12] with drift         : Inf
 ARIMA(0,0,3)(0,1,1)[12]                    : Inf
 ARIMA(0,0,3)(0,1,1)[12] with drift         : Inf
 ARIMA(0,0,3)(0,1,2)[12]                    : Inf
 ARIMA(0,0,3)(0,1,2)[12] with drift         : Inf
 ARIMA(0,0,3)(1,1,0)[12]                    : Inf
 ARIMA(0,0,3)(1,1,0)[12] with drift         : Inf
 ARIMA(0,0,3)(1,1,1)[12]                    : Inf
 ARIMA(0,0,3)(1,1,1)[12] with drift         : Inf
 ARIMA(0,0,3)(2,1,0)[12]                    : Inf
 ARIMA(0,0,3)(2,1,0)[12] with drift         : Inf
 ARIMA(0,0,4)(0,1,0)[12]                    : Inf
 ARIMA(0,0,4)(0,1,0)[12] with drift         : Inf
 ARIMA(0,0,4)(0,1,1)[12]                    : Inf
 ARIMA(0,0,4)(0,1,1)[12] with drift         : Inf
 ARIMA(0,0,4)(1,1,0)[12]                    : Inf
 ARIMA(0,0,4)(1,1,0)[12] with drift         : Inf
 ARIMA(0,0,5)(0,1,0)[12]                    : Inf
 ARIMA(0,0,5)(0,1,0)[12] with drift         : Inf
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1254.253
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1248.641
 ARIMA(1,0,0)(0,1,1)[12]                    : Inf
 ARIMA(1,0,0)(0,1,1)[12] with drift         : Inf
 ARIMA(1,0,0)(0,1,2)[12]                    : Inf
 ARIMA(1,0,0)(0,1,2)[12] with drift         : Inf
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1288.515
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1282.898
 ARIMA(1,0,0)(1,1,1)[12]                    : Inf
 ARIMA(1,0,0)(1,1,1)[12] with drift         : Inf
 ARIMA(1,0,0)(1,1,2)[12]                    : Inf
 ARIMA(1,0,0)(1,1,2)[12] with drift         : Inf
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1288.118
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1282.524
 ARIMA(1,0,0)(2,1,1)[12]                    : Inf
 ARIMA(1,0,0)(2,1,1)[12] with drift         : Inf
 ARIMA(1,0,0)(2,1,2)[12]                    : Inf
 ARIMA(1,0,0)(2,1,2)[12] with drift         : Inf
 ARIMA(1,0,1)(0,1,0)[12]                    : Inf
 ARIMA(1,0,1)(0,1,0)[12] with drift         : Inf
 ARIMA(1,0,1)(0,1,1)[12]                    : Inf
 ARIMA(1,0,1)(0,1,1)[12] with drift         : Inf
 ARIMA(1,0,1)(0,1,2)[12]                    : Inf
 ARIMA(1,0,1)(0,1,2)[12] with drift         : Inf
 ARIMA(1,0,1)(1,1,0)[12]                    : Inf
 ARIMA(1,0,1)(1,1,0)[12] with drift         : Inf
 ARIMA(1,0,1)(1,1,1)[12]                    : Inf
 ARIMA(1,0,1)(1,1,1)[12] with drift         : Inf
 ARIMA(1,0,1)(1,1,2)[12]                    : Inf
 ARIMA(1,0,1)(1,1,2)[12] with drift         : Inf
 ARIMA(1,0,1)(2,1,0)[12]                    : Inf
 ARIMA(1,0,1)(2,1,0)[12] with drift         : Inf
 ARIMA(1,0,1)(2,1,1)[12]                    : Inf
 ARIMA(1,0,1)(2,1,1)[12] with drift         : Inf
 ARIMA(1,0,2)(0,1,0)[12]                    : Inf
 ARIMA(1,0,2)(0,1,0)[12] with drift         : Inf
 ARIMA(1,0,2)(0,1,1)[12]                    : Inf
 ARIMA(1,0,2)(0,1,1)[12] with drift         : Inf
 ARIMA(1,0,2)(0,1,2)[12]                    : Inf
 ARIMA(1,0,2)(0,1,2)[12] with drift         : Inf
 ARIMA(1,0,2)(1,1,0)[12]                    : Inf
 ARIMA(1,0,2)(1,1,0)[12] with drift         : Inf
 ARIMA(1,0,2)(1,1,1)[12]                    : Inf
 ARIMA(1,0,2)(1,1,1)[12] with drift         : Inf
 ARIMA(1,0,2)(2,1,0)[12]                    : Inf
 ARIMA(1,0,2)(2,1,0)[12] with drift         : Inf
 ARIMA(1,0,3)(0,1,0)[12]                    : Inf
 ARIMA(1,0,3)(0,1,0)[12] with drift         : Inf
 ARIMA(1,0,3)(0,1,1)[12]                    : Inf
 ARIMA(1,0,3)(0,1,1)[12] with drift         : Inf
 ARIMA(1,0,3)(1,1,0)[12]                    : Inf
 ARIMA(1,0,3)(1,1,0)[12] with drift         : Inf
 ARIMA(1,0,4)(0,1,0)[12]                    : Inf
 ARIMA(1,0,4)(0,1,0)[12] with drift         : Inf
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1296.043
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1290.419
 ARIMA(2,0,0)(0,1,1)[12]                    : Inf
 ARIMA(2,0,0)(0,1,1)[12] with drift         : Inf
 ARIMA(2,0,0)(0,1,2)[12]                    : Inf
 ARIMA(2,0,0)(0,1,2)[12] with drift         : Inf
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1324.337
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1318.711
 ARIMA(2,0,0)(1,1,1)[12]                    : Inf
 ARIMA(2,0,0)(1,1,1)[12] with drift         : Inf
 ARIMA(2,0,0)(1,1,2)[12]                    : Inf
 ARIMA(2,0,0)(1,1,2)[12] with drift         : Inf
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1322.881
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1317.273
 ARIMA(2,0,0)(2,1,1)[12]                    : Inf
 ARIMA(2,0,0)(2,1,1)[12] with drift         : Inf
 ARIMA(2,0,1)(0,1,0)[12]                    : Inf
 ARIMA(2,0,1)(0,1,0)[12] with drift         : Inf
 ARIMA(2,0,1)(0,1,1)[12]                    : Inf
 ARIMA(2,0,1)(0,1,1)[12] with drift         : Inf
 ARIMA(2,0,1)(0,1,2)[12]                    : Inf
 ARIMA(2,0,1)(0,1,2)[12] with drift         : Inf
 ARIMA(2,0,1)(1,1,0)[12]                    : Inf
 ARIMA(2,0,1)(1,1,0)[12] with drift         : Inf
 ARIMA(2,0,1)(1,1,1)[12]                    : Inf
 ARIMA(2,0,1)(1,1,1)[12] with drift         : Inf
 ARIMA(2,0,1)(2,1,0)[12]                    : Inf
 ARIMA(2,0,1)(2,1,0)[12] with drift         : Inf
 ARIMA(2,0,2)(0,1,0)[12]                    : Inf
 ARIMA(2,0,2)(0,1,0)[12] with drift         : Inf
 ARIMA(2,0,2)(0,1,1)[12]                    : Inf
 ARIMA(2,0,2)(0,1,1)[12] with drift         : Inf
 ARIMA(2,0,2)(1,1,0)[12]                    : Inf
 ARIMA(2,0,2)(1,1,0)[12] with drift         : Inf
 ARIMA(2,0,3)(0,1,0)[12]                    : Inf
 ARIMA(2,0,3)(0,1,0)[12] with drift         : Inf
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1299.895
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1294.274
 ARIMA(3,0,0)(0,1,1)[12]                    : Inf
 ARIMA(3,0,0)(0,1,1)[12] with drift         : Inf
 ARIMA(3,0,0)(0,1,2)[12]                    : Inf
 ARIMA(3,0,0)(0,1,2)[12] with drift         : Inf
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1331.524
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1325.897
 ARIMA(3,0,0)(1,1,1)[12]                    : Inf
 ARIMA(3,0,0)(1,1,1)[12] with drift         : Inf
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1327.475
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1321.866
 ARIMA(3,0,1)(0,1,0)[12]                    : Inf
 ARIMA(3,0,1)(0,1,0)[12] with drift         : Inf
 ARIMA(3,0,1)(0,1,1)[12]                    : Inf
 ARIMA(3,0,1)(0,1,1)[12] with drift         : Inf
 ARIMA(3,0,1)(1,1,0)[12]                    : Inf
 ARIMA(3,0,1)(1,1,0)[12] with drift         : Inf
 ARIMA(3,0,2)(0,1,0)[12]                    : Inf
 ARIMA(3,0,2)(0,1,0)[12] with drift         : Inf
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1295.28
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1289.679
 ARIMA(4,0,0)(0,1,1)[12]                    : Inf
 ARIMA(4,0,0)(0,1,1)[12] with drift         : Inf
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1328.722
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1323.111
 ARIMA(4,0,1)(0,1,0)[12]                    : Inf
 ARIMA(4,0,1)(0,1,0)[12] with drift         : Inf
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1289.405
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1283.807

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(3,0,0)(1,1,0)[12] errors 

Series: ts_ts(data$df_Retail_sales) 
Regression with ARIMA(3,0,0)(1,1,0)[12] errors 

Coefficients:
          ar1      ar2      ar3     sar1  Series.1  Series.2  Series.3  Series.4  Series.5  Series.6  Series.7
      -0.7780  -0.5118  -0.1977  -0.3457   -0.0005   -0.0073   -0.1060   -0.1102    0.2583   -0.0085    0.0062
s.e.   0.0592   0.0705   0.0605   0.0608    0.0116    0.0145    0.0151    0.0158    0.0153    0.0150    0.0148
      Series.8  Series.9  Series.10  Series.11  Series.12  Series.13  Series.14  Series.15  Series.16  Series.17
       -0.0231   -0.0078     0.0230    -0.0217     0.0224    -0.0628    -0.0652     0.1922    -0.0076    -0.0349
s.e.    0.0148    0.0148     0.0148     0.0148     0.0147     0.0146     0.0146     0.0146     0.0147     0.0146
      Series.18  Series.19  Series.20  Series.21  Series.22  Series.23  Series.24  df_Retail_EU  df_Retail_EU.1
        -0.0316    -0.0121     0.0141    -0.0024     0.0305    -0.0074    -0.0135        0.4529         -0.0171
s.e.     0.0147     0.0148     0.0145     0.0146     0.0145     0.0145     0.0117        0.0816          0.0822

sigma^2 = 0.0002066:  log likelihood = 796.26
AIC=-1530.53   AICc=-1522.43   BIC=-1418.18
forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$df_CHFEUR),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1162.762
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1157.15
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1197.04
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1191.463
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1192.36
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1186.785
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1192.004
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1186.4
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1191.637
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1186.03
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1189.16
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1183.563
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1193.032
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1187.414
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1197.744
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1192.12
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1192.207
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1186.583
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1289.347
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1283.979
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1316.578
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1311.546
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1311.275
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1306.265
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1313.43
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1308.063
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1314.561
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1309.15
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1309.202
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1303.829
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1316.254
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1310.71
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1321.092
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1315.548
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1315.468
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1309.924
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1288.527
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1283.06
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1314.056
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1308.862
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1308.545
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1303.362
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1312.276
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1306.837
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1312.872
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1307.379
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1307.304
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1301.827
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1314.121
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1308.537
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1317.786
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1312.197
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1284.675
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1279.162
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1309.761
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1304.47
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1304.202
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1298.919
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1308.569
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1303.088
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1308.71
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1303.179
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1309.713
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1304.112
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1281.287
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1275.874
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1305.289
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1300.095
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1304.365
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1298.926
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1277.867
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1272.59
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1241.425
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1235.833
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1270.95
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1265.416
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1265.608
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1260.074
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1269.137
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1263.554
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1268.177
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1262.579
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1263.996
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1258.412
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1271.767
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1266.142
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1274.61
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1268.983
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1268.994
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1263.367
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1287.001
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1281.532
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1313.889
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1308.67
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1308.397
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1303.187
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1312.22
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1306.754
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1312.01
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1306.495
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1306.67
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1301.184
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1317.247
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1311.626
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1315.974
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1310.347
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1283.986
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1278.433
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1310.241
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1304.862
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1304.656
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1299.281
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1309.533
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1303.98
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1308.081
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1302.515
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1312.29
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1306.663
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1279.494
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1273.957
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1304.852
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1299.514
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1303.89
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1298.369
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1284.018
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1278.526
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1280.121
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1274.576
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1304.501
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1299.065
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1299.015
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1293.581
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1303.007
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1297.482
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1305.535
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1299.963
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1299.907
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1294.336
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1307.549
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1301.923
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1307.493
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1301.869
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1284.532
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1279.016
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1309.01
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1303.692
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1303.449
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1298.137
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1307.416
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1301.921
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1308.7
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1303.168
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1313.863
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1308.238
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1278.998
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1273.473
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1303.478
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1298.185
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1301.869
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1296.368
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1280.152
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1274.715
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1290.39
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1284.809
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1315.9
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1310.397
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1310.313
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1304.809
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1313.122
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1307.576
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1309.36
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1303.794
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1315.058
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1309.434
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1284.919
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1279.335
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1312.16
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1306.642
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1311.831
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1306.207
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1279.642
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1274.05
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1284.514
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1278.913
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1311.439
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1305.9
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1309.7
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1304.106
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1280.058
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1274.458
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1280.202
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1274.642

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(2,1,1)[12] errors 

Series: ts_ts(data$df_Retail_sales) 
Regression with ARIMA(0,0,1)(2,1,1)[12] errors 

Coefficients:
          ma1    sar1    sar2     sma1  Series.1  Series.2  Series.3  Series.4  Series.5  Series.6  Series.7  Series.8
      -0.7105  0.1798  0.0480  -0.5621    0.0012    0.0041   -0.0808   -0.1313    0.2679   -0.0256    0.0062   -0.0121
s.e.   0.0419  0.2238  0.1106   0.2132    0.0128    0.0155    0.0155    0.0156    0.0156    0.0156    0.0156    0.0156
      Series.9  Series.10  Series.11  Series.12  Series.13  Series.14  Series.15  Series.16  Series.17  Series.18
       -0.0173     0.0387    -0.0298     0.0348    -0.0664    -0.0624     0.1969    -0.0105    -0.0366    -0.0375
s.e.    0.0156     0.0155     0.0155     0.0153     0.0153     0.0155     0.0155     0.0156     0.0156     0.0157
      Series.19  Series.20  Series.21  Series.22  Series.23  Series.24  df_CHFEUR
        -0.0179     0.0143    -0.0022     0.0375    -0.0028    -0.0078     0.0623
s.e.     0.0157     0.0155     0.0155     0.0156     0.0156     0.0128     0.0361

sigma^2 = 0.0002281:  log likelihood = 785.07
AIC=-1510.15   AICc=-1502.62   BIC=-1401.32
forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$df_Retail_EU,
                                  data$df_CHFEUR),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1184.17
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1178.551
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1219.398
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1213.785
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1213.928
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1208.315
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1223.131
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1217.521
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1222.547
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1216.931
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1218.036
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1212.422
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1222.187
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1216.559
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1220.962
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1215.34
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1215.45
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1209.828
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1309.572
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1304.043
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1338.992
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1333.469
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1333.382
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1327.861
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1335.185
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1329.641
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1335.191
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1329.616
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1329.661
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1324.092
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1341.928
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1336.311
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1341.917
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1336.334
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1336.304
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1330.719
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1308.34
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1302.775
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1337.087
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1331.532
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1331.475
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1325.919
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1334.662
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1329.106
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1334.632
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1329.04
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1329.015
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1323.421
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1340.05
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1334.436
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1339.602
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1334.025
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1303.851
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1298.27
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1332.447
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1326.878
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1326.832
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1321.263
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1331.087
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1325.525
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1331.343
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1325.742
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1335.672
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1330.059
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1300.89
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1295.352
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1327.472
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1321.919
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1326.096
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1320.538
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1297.439
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1291.938
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1263.443
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1257.832
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1296.697
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1291.082
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1291.254
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1285.639
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1299.973
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1294.358
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1298.288
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1292.663
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1292.725
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1287.101
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1299.974
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1294.362
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1296.169
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1290.576
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1290.544
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1284.95
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1306.687
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1301.116
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1336.199
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1330.625
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1330.582
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1325.009
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1337.609
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1331.999
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1336.315
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1330.688
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1330.743
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1325.117
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1342.084
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1336.539
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1337.534
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1332.026
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1302.909
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1297.309
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1332.308
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1326.705
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1326.722
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1321.119
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1337.721
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1332.162
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1334.33
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1328.801
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1336.787
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1331.25
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1298.3
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1292.707
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1326.882
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1321.293
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1335.354
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1329.846
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1299.852
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1294.224
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1300.357
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1294.765
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1327.467
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1321.878
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1321.847
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1316.258
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1329.21
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1323.614
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1330.379
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1324.756
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1324.788
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1319.164
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1334.035
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1328.452
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1329.957
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1324.407
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1303.465
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1297.88
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1330.708
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1325.137
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1325.085
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1319.514
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1331.47
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1325.87
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1332.083
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1326.462
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1338.986
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1333.418
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1297.84
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1292.255
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1325.299
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1319.733
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1325.877
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1320.277
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1303.223
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1297.675
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1308.966
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1303.349
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1337.827
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1332.205
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1332.551
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1326.93
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1338.525
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1332.904
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1334.112
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1328.486
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1340.138
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1334.547
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1303.344
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1297.727
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1333.488
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1327.861
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1337.837
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1332.293
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1297.918
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1292.299
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1302.823
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1297.2
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1332.501
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1326.873
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1335.882
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1330.256
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1297.869
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1292.244
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1298.567
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1292.964

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(1,0,1)(2,1,0)[12] errors 

Series: ts_ts(data$df_Retail_sales) 
Regression with ARIMA(1,0,1)(2,1,0)[12] errors 

Coefficients:
          ar1      ma1     sar1     sar2  Series.1  Series.2  Series.3  Series.4  Series.5  Series.6  Series.7
      -0.1511  -0.6163  -0.3848  -0.0919    0.0014   -0.0083   -0.1059   -0.1052    0.2547   -0.0105    0.0084
s.e.   0.0834   0.0663   0.0647   0.0684    0.0118    0.0148    0.0154    0.0158    0.0152    0.0150    0.0149
      Series.8  Series.9  Series.10  Series.11  Series.12  Series.13  Series.14  Series.15  Series.16  Series.17
        -0.025   -0.0092     0.0248    -0.0227     0.0215    -0.0634    -0.0650     0.1907    -0.0079    -0.0337
s.e.     0.015    0.0148     0.0150     0.0148     0.0148     0.0146     0.0147     0.0148     0.0148     0.0148
      Series.18  Series.19  Series.20  Series.21  Series.22  Series.23  Series.24  df_Retail_EU  df_CHFEUR
        -0.0314    -0.0123     0.0133    -0.0024     0.0298    -0.0050    -0.0108        0.4602     0.0692
s.e.     0.0149     0.0149     0.0148     0.0148     0.0148     0.0147     0.0119        0.0825     0.0340

sigma^2 = 0.0002062:  log likelihood = 799.85
AIC=-1537.7   AICc=-1529.63   BIC=-1425.24

Model with Exogenous variable Retail EU

Model the multivariate model with Auto Arima to account for the seosonality.

AR/MA terms for the evaluation (see chapter Evaluation):

Retail_EU_cycle: ARIMA(2,0,3) ARIMA(0,0,1)(0,1,1)[12] CHFEUR: ARIMA(0,0,1) Retail_EU_cycle AND CHFEUR: ARIMA(0,0,1) ARIMA(1,0,1)(2,1,0)[12]

modelretailsales <- forecast::auto.arima(ts_ts(data$df_Retail_sales),
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$df_Retail_EU
                                  ),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1186.405
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1180.785
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1221.354
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1215.739
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1216.148
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1210.534
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1222.289
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1216.676
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1221.957
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1216.341
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1217.901
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1212.287
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1219.63
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1214.003
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1219.999
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1214.373
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1214.476
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1208.85
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1312.424
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1306.889
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1341.664
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1336.138
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1336.24
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1330.72
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1336.113
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1330.565
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1336.828
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1331.267
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1331.487
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1325.935
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1341.735
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1336.11
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1341.534
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1335.916
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1336.256
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1330.635
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1311.167
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1305.599
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1339.729
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1334.172
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1334.136
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1328.58
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1335.577
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1330.019
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1336.006
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1330.423
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1330.405
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1324.826
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1339.765
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1334.142
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1339.078
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1333.467
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1306.639
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1301.058
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1335.128
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1329.558
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1329.536
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1323.967
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1331.933
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1326.369
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1332.58
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1326.987
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1335.317
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1329.696
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1303.797
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1298.253
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1330.239
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1324.684
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1327.128
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1321.568
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1299.658
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1294.144
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1265.476
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1259.862
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1298.491
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1292.875
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1292.886
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1287.27
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1299.829
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1294.212
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1298.197
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1292.573
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1292.848
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1287.225
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1298.173
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1292.556
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1294.727
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1289.117
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1289.169
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1283.559
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1309.445
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1303.873
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1338.685
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1333.111
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1333.106
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1327.534
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1338.349
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1332.737
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1337.459
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1331.833
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1332.12
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1326.497
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1340.752
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1335.173
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1336.123
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1330.561
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1305.582
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1299.984
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1334.741
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1329.14
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1329.128
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1323.527
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1338.046
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1332.453
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1334.737
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1329.14
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1335.381
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1329.809
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1301.068
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1295.476
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1329.491
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1323.904
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1334.848
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1329.297
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1301.224
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1295.597
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1303.643
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1298.05
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1330.657
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1325.067
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1325.053
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1319.463
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1330.794
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1325.196
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1332.41
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1326.788
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1326.782
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1321.161
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1333.98
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1328.384
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1329.824
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1324.245
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1306.409
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1300.824
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1333.494
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1327.923
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1327.917
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1322.347
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1332.714
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1327.113
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1333.814
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1328.196
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1338.208
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1332.617
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1300.783
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1295.198
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1328.112
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1322.546
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1327.122
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1321.521
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1305.589
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1300.296
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1311.23
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1305.612
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1339.867
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1334.246
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1334.299
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1328.677
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1339.041
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1333.42
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1334.709
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1329.083
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1339.28
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1333.672
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1305.602
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1299.985
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1335.307
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1329.68
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1337.655
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1332.075
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1300.103
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1294.485
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1304.931
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1299.308
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1334.141
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1328.514
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1336.269
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1330.643
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1299.898
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1294.273
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1301.005
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1295.405

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(2,1,0)[12] errors 
# Check AR/MA terms for later use in the evaluation part Retail EU 
forecast::auto.arima(data$Retail_EU_cycle,
                     ic="bic",
                     xreg = pandemicDummies["2000-02-01/2024-03-01"], 
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0) errors : -1453.484
 Regression with ARIMA(0,0,0) errors : -1447.836
 Regression with ARIMA(0,0,1) errors : -1510.089
 Regression with ARIMA(0,0,1) errors : -1504.624
 Regression with ARIMA(0,0,2) errors : -1507.769
 Regression with ARIMA(0,0,2) errors : -1502.368
 Regression with ARIMA(0,0,3) errors : -1507.425
 Regression with ARIMA(0,0,3) errors : -1502.021
 Regression with ARIMA(0,0,4) errors : -1508.286
 Regression with ARIMA(0,0,4) errors : -1502.808
 Regression with ARIMA(0,0,5) errors : -1512.158
 Regression with ARIMA(0,0,5) errors : -1506.763
 Regression with ARIMA(1,0,0) errors : -1494.178
 Regression with ARIMA(1,0,0) errors : -1488.584
 Regression with ARIMA(1,0,1) errors : -1509.802
 Regression with ARIMA(1,0,1) errors : -1504.541
 Regression with ARIMA(1,0,2) errors : -1505.937
 Regression with ARIMA(1,0,2) errors : -1500.749
 Regression with ARIMA(1,0,3) errors : -1503.522
 Regression with ARIMA(1,0,3) errors : -1498.223
 Regression with ARIMA(1,0,4) errors : -1508.315
 Regression with ARIMA(1,0,4) errors : -1502.912
 Regression with ARIMA(2,0,0) errors : -1495.053
 Regression with ARIMA(2,0,0) errors : -1489.494
 Regression with ARIMA(2,0,1) errors : -1505.06
 Regression with ARIMA(2,0,1) errors : -1499.757
 Regression with ARIMA(2,0,2) errors : -1499.51
 Regression with ARIMA(2,0,2) errors : -1494.211
 Regression with ARIMA(2,0,3) errors : -1514.992
 Regression with ARIMA(2,0,3) errors : -1509.534
 Regression with ARIMA(3,0,0) errors : -1489.139
 Regression with ARIMA(3,0,0) errors : -1483.625
 Regression with ARIMA(3,0,1) errors : -1499.847
 Regression with ARIMA(3,0,1) errors : -1494.748
 Regression with ARIMA(3,0,2) errors : -1498.164
 Regression with ARIMA(3,0,2) errors : -1492.968
 Regression with ARIMA(4,0,0) errors : -1509.368
 Regression with ARIMA(4,0,0) errors : -1503.954
 Regression with ARIMA(4,0,1) errors : -1506.854
 Regression with ARIMA(4,0,1) errors : -1501.509
 Regression with ARIMA(5,0,0) errors : -1505.04
 Regression with ARIMA(5,0,0) errors : -1499.666

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(2,0,3) errors 

Series: data$Retail_EU_cycle 
Regression with ARIMA(2,0,3) errors 

Coefficients:
         ar1      ar2      ma1     ma2      ma3  Series 1  Series 2  Series 3  Series 4  Series 5  Series 6  Series 7
      0.9429  -0.9514  -1.4912  1.5194  -0.6537    0.0040    0.0232    0.0518   -0.0522    0.0351   -0.0309   -0.0223
s.e.  0.0309   0.0247   0.0489  0.0505   0.0505    0.0127    0.0145    0.0145    0.0145    0.0146    0.0146    0.0146
      Series 8  Series 9  Series 10  Series 11  Series 12  Series 13  Series 14  Series 15  Series 16  Series 17
        0.0459   -0.0333     0.0261    -0.0126     0.0009     0.0169     0.0009     0.0159    -0.0062    -0.0003
s.e.    0.0146    0.0146     0.0146     0.0147     0.0147     0.0147     0.0147     0.0147     0.0147     0.0147
      Series 18  Series 19  Series 20  Series 21  Series 22  Series 23  Series 24
        -0.0193    -0.0311     0.0240    -0.0124     0.0098     0.0075    -0.0148
s.e.     0.0146     0.0146     0.0146     0.0146     0.0145     0.0146     0.0128

sigma^2 = 0.0001808:  log likelihood = 851.62
AIC=-1643.24   AICc=-1636.06   BIC=-1533.15
# Check AR/MA terms for later use in the evaluation part CHF/EUR 
forecast::auto.arima(data$df_CHFEUR,
                     ic="bic",
                     xreg = pandemicDummies["2000-02-01/2024-03-01"],
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0) errors : -1552.588
 Regression with ARIMA(0,0,0) errors : -1551.689
 Regression with ARIMA(0,0,1) errors : -1557.692
 Regression with ARIMA(0,0,1) errors : -1555.399
 Regression with ARIMA(0,0,2) errors : -1553.445
 Regression with ARIMA(0,0,2) errors : -1551.725
 Regression with ARIMA(0,0,3) errors : -1551.227
 Regression with ARIMA(0,0,3) errors : -1548.755
 Regression with ARIMA(0,0,4) errors : -1546.827
 Regression with ARIMA(0,0,4) errors : -1544.76
 Regression with ARIMA(0,0,5) errors : -1541.179
 Regression with ARIMA(0,0,5) errors : -1539.092
 Regression with ARIMA(1,0,0) errors : -1555.467
 Regression with ARIMA(1,0,0) errors : -1553.086
 Regression with ARIMA(1,0,1) errors : -1555.438
 Regression with ARIMA(1,0,1) errors : -1553.607
 Regression with ARIMA(1,0,2) errors : -1549.956
 Regression with ARIMA(1,0,2) errors : -1547.989
 Regression with ARIMA(1,0,3) errors : -1545.542
 Regression with ARIMA(1,0,3) errors : -1543.13
 Regression with ARIMA(1,0,4) errors : -1540.183
 Regression with ARIMA(1,0,4) errors : -1538.09
 Regression with ARIMA(2,0,0) errors : -1549.641
 Regression with ARIMA(2,0,0) errors : -1547.723
 Regression with ARIMA(2,0,1) errors : -1548.821
 Regression with ARIMA(2,0,1) errors : -1547.024
 Regression with ARIMA(2,0,2) errors : -1544.822
 Regression with ARIMA(2,0,2) errors : -1541.499
 Regression with ARIMA(2,0,3) errors : -1541.91
 Regression with ARIMA(2,0,3) errors : -1540.843
 Regression with ARIMA(3,0,0) errors : -1547.781
 Regression with ARIMA(3,0,0) errors : -1544.951
 Regression with ARIMA(3,0,1) errors : -1543.676
 Regression with ARIMA(3,0,1) errors : -1541.083
 Regression with ARIMA(3,0,2) errors : -1539.063
 Regression with ARIMA(3,0,2) errors : -1535.88
 Regression with ARIMA(4,0,0) errors : -1544.283
 Regression with ARIMA(4,0,0) errors : -1542.051
 Regression with ARIMA(4,0,1) errors : -1540.655
 Regression with ARIMA(4,0,1) errors : -1538.239
 Regression with ARIMA(5,0,0) errors : -1540.108
 Regression with ARIMA(5,0,0) errors : -1537.331

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1) errors 

Series: data$df_CHFEUR 
Regression with ARIMA(0,0,1) errors 

Coefficients:
         ma1  Series 1  Series 2  Series 3  Series 4  Series 5  Series 6  Series 7  Series 8  Series 9  Series 10
      0.2081   -0.0145   -0.0106   -0.0057   -0.0044    0.0022    0.0141   -0.0011    0.0058    0.0015    -0.0041
s.e.  0.0635    0.0128    0.0131    0.0131    0.0131    0.0131    0.0131    0.0131    0.0131    0.0131     0.0131
      Series 11  Series 12  Series 13  Series 14  Series 15  Series 16  Series 17  Series 18  Series 19  Series 20
         0.0037     0.0033    -0.0021     0.0058     0.0189    -0.0027    -0.0059    -0.0026    -0.0079    -0.0087
s.e.     0.0131     0.0131     0.0131     0.0131     0.0131     0.0131     0.0131     0.0131     0.0131     0.0131
      Series 21  Series 22  Series 23  Series 24
         0.0092    -0.0135    -0.0181    -0.0103
s.e.     0.0131     0.0131     0.0131     0.0128

sigma^2 = 0.0001791:  log likelihood = 852.53
AIC=-1653.07   AICc=-1647.73   BIC=-1557.65
# Check AR/MA terms for later use in the evaluation part Retail EU AND CHF/EUR 
forecast::auto.arima(data$Retail_sales_cycle,
                     ic="bic",
                     xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                  data$Retail_EU_cycle,
                                  data$df_CHFEUR),
                     max.d = 0, 
                     trace = TRUE,
                     stepwise = FALSE)

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0) errors : -1244.49
 Regression with ARIMA(0,0,0) errors : -1238.843
 Regression with ARIMA(0,0,1) errors : -1345.976
 Regression with ARIMA(0,0,1) errors : -1340.322
 Regression with ARIMA(0,0,2) errors : -1343.305
 Regression with ARIMA(0,0,2) errors : -1337.65
 Regression with ARIMA(0,0,3) errors : -1342.721
 Regression with ARIMA(0,0,3) errors : -1337.073
 Regression with ARIMA(0,0,4) errors : -1337.122
 Regression with ARIMA(0,0,4) errors : -1331.474
 Regression with ARIMA(0,0,5) errors : -1331.66
 Regression with ARIMA(0,0,5) errors : -1326.015
 Regression with ARIMA(1,0,0) errors : -1286.677
 Regression with ARIMA(1,0,0) errors : -1281.01
 Regression with ARIMA(1,0,1) errors : -1337.999
 Regression with ARIMA(1,0,1) errors : -1332.407
 Regression with ARIMA(1,0,2) errors : -1344.05
 Regression with ARIMA(1,0,2) errors : -1338.446
 Regression with ARIMA(1,0,3) errors : -1338.459
 Regression with ARIMA(1,0,3) errors : -1332.857
 Regression with ARIMA(1,0,4) errors : -1333.894
 Regression with ARIMA(1,0,4) errors : -1328.284
 Regression with ARIMA(2,0,0) errors : -1327.212
 Regression with ARIMA(2,0,0) errors : -1321.55
 Regression with ARIMA(2,0,1) errors : -1340.255
 Regression with ARIMA(2,0,1) errors : -1334.585
 Regression with ARIMA(2,0,2) errors : -1341.744
 Regression with ARIMA(2,0,2) errors : -1336.085
 Regression with ARIMA(2,0,3) errors : -1347.059
 Regression with ARIMA(2,0,3) errors : -1339.645
 Regression with ARIMA(3,0,0) errors : -1332.447
 Regression with ARIMA(3,0,0) errors : -1326.778
 Regression with ARIMA(3,0,1) errors : -1336.363
 Regression with ARIMA(3,0,1) errors : -1330.751
 Regression with ARIMA(3,0,2) errors : -1335.994
 Regression with ARIMA(3,0,2) errors : -1330.372
 Regression with ARIMA(4,0,0) errors : -1335.228
 Regression with ARIMA(4,0,0) errors : -1329.564
 Regression with ARIMA(4,0,1) errors : -1338.631
 Regression with ARIMA(4,0,1) errors : -1332.978
 Regression with ARIMA(5,0,0) errors : -1343.013
 Regression with ARIMA(5,0,0) errors : -1337.343

 Now re-fitting the best model(s) without approximations...

 Regression with ARIMA(0,0,0) errors : -1244.49
 Regression with ARIMA(0,0,0) errors : -1238.843
 Regression with ARIMA(0,0,1) errors : -1345.454
 Regression with ARIMA(0,0,1) errors : -1339.809
 Regression with ARIMA(0,0,2) errors : -1342.768
 Regression with ARIMA(0,0,2) errors : -1337.122
 Regression with ARIMA(0,0,3) errors : -1342.083
 Regression with ARIMA(0,0,3) errors : -1336.438
 Regression with ARIMA(0,0,4) errors : -1336.528
 Regression with ARIMA(0,0,4) errors : -1330.885
 Regression with ARIMA(0,0,5) errors : -1331.074
 Regression with ARIMA(0,0,5) errors : -1325.432
 Regression with ARIMA(1,0,0) errors : -1285.353
 Regression with ARIMA(1,0,0) errors : -1279.695
 Regression with ARIMA(1,0,1) errors : -1341.948
 Regression with ARIMA(1,0,1) errors : -1336.303
 Regression with ARIMA(1,0,2) errors : -1341.158
 Regression with ARIMA(1,0,2) errors : -1335.517
 Regression with ARIMA(1,0,3) errors : -1336.573
 Regression with ARIMA(1,0,3) errors : -1330.93
 Regression with ARIMA(1,0,4) errors : -1330.91
 Regression with ARIMA(1,0,4) errors : -1325.267
 Regression with ARIMA(2,0,0) errors : -1322.544
 Regression with ARIMA(2,0,0) errors : -1316.876
 Regression with ARIMA(2,0,1) errors : -1341.004
 Regression with ARIMA(2,0,1) errors : -1335.358
 Regression with ARIMA(2,0,2) errors : -1336.522
 Regression with ARIMA(2,0,2) errors : -1330.879
 Regression with ARIMA(2,0,3) errors : Inf
 Regression with ARIMA(2,0,3) errors : Inf
 Regression with ARIMA(3,0,0) errors : -1324.756
 Regression with ARIMA(3,0,0) errors : -1319.086
 Regression with ARIMA(3,0,1) errors : -1335.958
 Regression with ARIMA(3,0,1) errors : -1330.312
 Regression with ARIMA(3,0,2) errors : -1330.861
 Regression with ARIMA(3,0,2) errors : -1325.219
 Regression with ARIMA(4,0,0) errors : -1328.487
 Regression with ARIMA(4,0,0) errors : -1322.82
 Regression with ARIMA(4,0,1) errors : -1331.332
 Regression with ARIMA(4,0,1) errors : -1325.688
 Regression with ARIMA(5,0,0) errors : -1331.526
 Regression with ARIMA(5,0,0) errors : -1325.863





 Best model: Regression with ARIMA(0,0,1) errors 

Series: data$Retail_sales_cycle 
Regression with ARIMA(0,0,1) errors 

Coefficients:
          ma1  Series.1  Series.2  Series.3  Series.4  Series.5  Series.6  Series.7  Series.8  Series.9  Series.10
      -0.7472   -0.0216   -0.0002   -0.0742   -0.1189    0.2418    0.0244   -0.0176   -0.0322   -0.0193     0.0400
s.e.   0.0381    0.0181    0.0226    0.0228    0.0230    0.0227    0.0227    0.0226    0.0228    0.0227     0.0226
      Series.11  Series.12  Series.13  Series.14  Series.15  Series.16  Series.17  Series.18  Series.19  Series.20
        -0.0069     0.0122    -0.0903    -0.0564     0.2190    -0.0190    -0.0462     0.0019    -0.0412     0.0051
s.e.     0.0226     0.0226     0.0226     0.0226     0.0226     0.0226     0.0226     0.0226     0.0226     0.0226
      Series.21  Series.22  Series.23  Series.24  Retail_EU_cycle  df_CHFEUR
        -0.0092     0.0392     0.0166    -0.0366           0.3031     0.0377
s.e.     0.0226     0.0226     0.0226     0.0181           0.0749     0.0473

sigma^2 = 0.0003598:  log likelihood = 752.11
AIC=-1448.21   AICc=-1441.99   BIC=-1345.45

Model and plot forecast for Retail EU

modelretaileu <- forecast::auto.arima(ts_ts(data$df_Retail_EU), 
                                         xreg = pandemicDummies["2000-02-01/2024-03-01"], 
                                         ic = "bic",
                                         trace = TRUE,
                                         stepwise = FALSE
                                         )

 Fitting models using approximations to speed things up...

 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1375.828
 Regression with ARIMA(0,0,0)(0,1,0)[12] errors : -1370.212
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1439.981
 Regression with ARIMA(0,0,0)(0,1,1)[12] errors : -1434.534
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1435.801
 Regression with ARIMA(0,0,0)(0,1,2)[12] errors : -1430.349
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1431.404
 Regression with ARIMA(0,0,0)(1,1,0)[12] errors : -1425.797
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1439.023
 Regression with ARIMA(0,0,0)(1,1,1)[12] errors : -1433.446
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1434.046
 Regression with ARIMA(0,0,0)(1,1,2)[12] errors : -1428.477
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1443.138
 Regression with ARIMA(0,0,0)(2,1,0)[12] errors : -1437.644
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1439.002
 Regression with ARIMA(0,0,0)(2,1,1)[12] errors : -1433.552
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1433.999
 Regression with ARIMA(0,0,0)(2,1,2)[12] errors : -1428.564
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1479.329
 Regression with ARIMA(0,0,1)(0,1,0)[12] errors : -1473.944
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1523.343
 Regression with ARIMA(0,0,1)(0,1,1)[12] errors : -1519.105
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1517.815
 Regression with ARIMA(0,0,1)(0,1,2)[12] errors : -1513.565
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1511.938
 Regression with ARIMA(0,0,1)(1,1,0)[12] errors : -1506.614
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1514.147
 Regression with ARIMA(0,0,1)(1,1,1)[12] errors : -1508.904
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1511.651
 Regression with ARIMA(0,0,1)(1,1,2)[12] errors : -1506.538
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1517.277
 Regression with ARIMA(0,0,1)(2,1,0)[12] errors : -1512.56
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1512.749
 Regression with ARIMA(0,0,1)(2,1,1)[12] errors : -1508.186
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1507.136
 Regression with ARIMA(0,0,1)(2,1,2)[12] errors : -1502.573
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1478.913
 Regression with ARIMA(0,0,2)(0,1,0)[12] errors : -1473.48
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1520.007
 Regression with ARIMA(0,0,2)(0,1,1)[12] errors : -1515.547
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1514.41
 Regression with ARIMA(0,0,2)(0,1,2)[12] errors : -1509.947
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1507.428
 Regression with ARIMA(0,0,2)(1,1,0)[12] errors : -1502.052
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1509.236
 Regression with ARIMA(0,0,2)(1,1,1)[12] errors : -1503.945
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1507.038
 Regression with ARIMA(0,0,2)(1,1,2)[12] errors : -1501.858
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1512.546
 Regression with ARIMA(0,0,2)(2,1,0)[12] errors : -1507.746
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1508.087
 Regression with ARIMA(0,0,2)(2,1,1)[12] errors : -1503.428
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1473.661
 Regression with ARIMA(0,0,3)(0,1,0)[12] errors : -1468.217
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1514.593
 Regression with ARIMA(0,0,3)(0,1,1)[12] errors : -1510.078
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1509.007
 Regression with ARIMA(0,0,3)(0,1,2)[12] errors : -1504.487
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1502.956
 Regression with ARIMA(0,0,3)(1,1,0)[12] errors : -1497.543
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1505.081
 Regression with ARIMA(0,0,3)(1,1,1)[12] errors : -1499.749
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1508.239
 Regression with ARIMA(0,0,3)(2,1,0)[12] errors : -1503.372
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1468.166
 Regression with ARIMA(0,0,4)(0,1,0)[12] errors : -1462.732
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1509.201
 Regression with ARIMA(0,0,4)(0,1,1)[12] errors : -1504.75
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1498.588
 Regression with ARIMA(0,0,4)(1,1,0)[12] errors : -1493.229
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1469.489
 Regression with ARIMA(0,0,5)(0,1,0)[12] errors : -1463.986
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1453.501
 Regression with ARIMA(1,0,0)(0,1,0)[12] errors : -1447.925
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1503.526
 Regression with ARIMA(1,0,0)(0,1,1)[12] errors : -1498.377
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1498.009
 Regression with ARIMA(1,0,0)(0,1,2)[12] errors : -1492.859
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1490.335
 Regression with ARIMA(1,0,0)(1,1,0)[12] errors : -1484.829
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1493.812
 Regression with ARIMA(1,0,0)(1,1,1)[12] errors : -1488.393
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1490.272
 Regression with ARIMA(1,0,0)(1,1,2)[12] errors : -1484.883
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1494.169
 Regression with ARIMA(1,0,0)(2,1,0)[12] errors : -1488.889
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1491.281
 Regression with ARIMA(1,0,0)(2,1,1)[12] errors : -1486.057
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1486.651
 Regression with ARIMA(1,0,0)(2,1,2)[12] errors : -1481.459
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1477.687
 Regression with ARIMA(1,0,1)(0,1,0)[12] errors : -1472.237
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1519.257
 Regression with ARIMA(1,0,1)(0,1,1)[12] errors : -1514.757
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1513.653
 Regression with ARIMA(1,0,1)(0,1,2)[12] errors : -1509.151
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1510.102
 Regression with ARIMA(1,0,1)(1,1,0)[12] errors : -1504.918
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1512.182
 Regression with ARIMA(1,0,1)(1,1,1)[12] errors : -1507.215
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1509.107
 Regression with ARIMA(1,0,1)(1,1,2)[12] errors : -1504.232
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1511.038
 Regression with ARIMA(1,0,1)(2,1,0)[12] errors : -1506.224
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1507.938
 Regression with ARIMA(1,0,1)(2,1,1)[12] errors : -1503.259
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1475.733
 Regression with ARIMA(1,0,2)(0,1,0)[12] errors : -1470.106
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1516.329
 Regression with ARIMA(1,0,2)(0,1,1)[12] errors : -1510.938
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1510.702
 Regression with ARIMA(1,0,2)(0,1,2)[12] errors : -1505.313
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1504.502
 Regression with ARIMA(1,0,2)(1,1,0)[12] errors : -1499.318
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1506.557
 Regression with ARIMA(1,0,2)(1,1,1)[12] errors : -1501.59
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1507.612
 Regression with ARIMA(1,0,2)(2,1,0)[12] errors : -1502.144
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1469.753
 Regression with ARIMA(1,0,3)(0,1,0)[12] errors : -1464.376
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1508.748
 Regression with ARIMA(1,0,3)(0,1,1)[12] errors : -1504.171
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1502.151
 Regression with ARIMA(1,0,3)(1,1,0)[12] errors : -1496.851
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1464.393
 Regression with ARIMA(1,0,4)(0,1,0)[12] errors : -1459.013
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1476.896
 Regression with ARIMA(2,0,0)(0,1,0)[12] errors : -1471.375
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1518.193
 Regression with ARIMA(2,0,0)(0,1,1)[12] errors : -1513.281
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1512.631
 Regression with ARIMA(2,0,0)(0,1,2)[12] errors : -1507.719
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1511.143
 Regression with ARIMA(2,0,0)(1,1,0)[12] errors : -1505.75
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1513.664
 Regression with ARIMA(2,0,0)(1,1,1)[12] errors : -1508.416
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1509.94
 Regression with ARIMA(2,0,0)(1,1,2)[12] errors : -1504.737
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1512.986
 Regression with ARIMA(2,0,0)(2,1,0)[12] errors : -1507.919
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1508.536
 Regression with ARIMA(2,0,0)(2,1,1)[12] errors : -1503.529
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1473.196
 Regression with ARIMA(2,0,1)(0,1,0)[12] errors : -1467.703
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1513.983
 Regression with ARIMA(2,0,1)(0,1,1)[12] errors : -1509.287
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1508.388
 Regression with ARIMA(2,0,1)(0,1,2)[12] errors : -1503.691
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1505.723
 Regression with ARIMA(2,0,1)(1,1,0)[12] errors : -1500.382
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1508.122
 Regression with ARIMA(2,0,1)(1,1,1)[12] errors : -1502.928
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1508.018
 Regression with ARIMA(2,0,1)(2,1,0)[12] errors : -1503.037
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1476.529
 Regression with ARIMA(2,0,2)(0,1,0)[12] errors : -1471.002
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1512.144
 Regression with ARIMA(2,0,2)(0,1,1)[12] errors : -1507.416
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1502.403
 Regression with ARIMA(2,0,2)(1,1,0)[12] errors : -1497.115
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : Inf
 Regression with ARIMA(2,0,3)(0,1,0)[12] errors : -1465.432
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1471.297
 Regression with ARIMA(3,0,0)(0,1,0)[12] errors : -1465.762
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1512.35
 Regression with ARIMA(3,0,0)(0,1,1)[12] errors : -1507.415
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1506.769
 Regression with ARIMA(3,0,0)(0,1,2)[12] errors : -1501.834
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1504.766
 Regression with ARIMA(3,0,0)(1,1,0)[12] errors : -1499.412
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1506.926
 Regression with ARIMA(3,0,0)(1,1,1)[12] errors : -1501.723
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1507.736
 Regression with ARIMA(3,0,0)(2,1,0)[12] errors : -1502.583
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1467.838
 Regression with ARIMA(3,0,1)(0,1,0)[12] errors : -1462.31
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1508.471
 Regression with ARIMA(3,0,1)(0,1,1)[12] errors : -1503.65
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1500.488
 Regression with ARIMA(3,0,1)(1,1,0)[12] errors : -1495.295
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1463.123
 Regression with ARIMA(3,0,2)(0,1,0)[12] errors : -1457.612
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1469.169
 Regression with ARIMA(4,0,0)(0,1,0)[12] errors : -1463.642
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1509.541
 Regression with ARIMA(4,0,0)(0,1,1)[12] errors : -1504.718
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1502.171
 Regression with ARIMA(4,0,0)(1,1,0)[12] errors : -1496.891
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1463.776
 Regression with ARIMA(4,0,1)(0,1,0)[12] errors : -1458.258
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1464.185
 Regression with ARIMA(5,0,0)(0,1,0)[12] errors : -1458.715

 Now re-fitting the best model(s) without approximations...




 Best model: Regression with ARIMA(0,0,1)(0,1,1)[12] errors 
modelretaileu$bic  
[1] -1627.673
forecasteu <- forecast::forecast(modelretaileu, 
                                 xreg = pandemicDummies["2024-04-01/2025-03-01"])

plot(forecasteu)

Forecast Swiss Retail with exogneous variable Euro Retail

forecastretail <- forecast::forecast(modelretailsales, 
                                     xreg = cbind(pandemicDummies["2024-04-01/2025-03-01"],
                                     forecasteu$mean))

plot(forecastretail)

Reverse the differencing and log to get a point forecast of the index level. Add on to the last observed value and convert back to the original scale.

cumulative_forecasted_diffs <- cumsum(forecastretail$mean[1:12])

forecasted_series_final <- cumulative_forecasted_diffs + log(tail(data$Retail_sales, 1)[[1]])

forecasted_series_original_scale <- exp(forecasted_series_final)

print(forecasted_series_original_scale)
 Apr 2024  May 2024  Jun 2024  Jul 2024  Aug 2024  Sep 2024  Oct 2024  Nov 2024  Dec 2024  Jan 2025  Feb 2025  Mar 2025 
102.08462 109.29603 107.48698 105.17001 100.48072 101.09442 106.18451 114.25884 127.25783  99.81850  94.51278 107.49569 

Evaluation

Now for evaluation and for simplicity only use the data before the pandemic and non seasonal model. 6 models are evaluated and the AR/MA terms that have been determined in the previous analysis. 1) Univariate m/m 2) Univariate y/y 3) Multivariate with Retail EU 4) Multivariate with Retail EU AND CHF/EUR 5) Naive “no change” 6) Average of the above 5 models

dataeval <- data[as.Date(index(data)) <= as.Date("2020-01-01"), ]

tEvaluationPeriods <- 70
tPeriods = length(dataeval[,"Retail_sales"])
forecastHorizon = 12
nModels = 6 # we compare these models: univariate m/m, y/y, multivariate with EU Retail, CHFEUR, naive, average
forecastRolling <- matrix(,tEvaluationPeriods,nModels)
for (tauEvaluationPeriod in 1:tEvaluationPeriods){
  
  lastPeriod <- tPeriods-tEvaluationPeriods+tauEvaluationPeriod-forecastHorizon 
  
  # Univariate model, m/m 
  modelRetail_temp <- forecast::Arima(ts_ts(dataeval$df_Retail_sales[1:lastPeriod]),
                                        order = c(0, 0, 1), seasonal=c(2, 1, 1))
  forecastRetail_temp <- forecast::forecast(modelRetail_temp, h = forecastHorizon)
  forecastRolling[tauEvaluationPeriod,1] <- sum(forecastRetail_temp$mean[1:forecastHorizon]) # y/y forecast is sum of m/m (with logs)

  # Univariate model, y/y
  modelRetail_temp = forecast::Arima(dataeval$df12_Retail_sales[12:lastPeriod],
                                        order = c(1, 0, 1))
  forecastRetail_temp = forecast::forecast(modelRetail_temp, h = forecastHorizon)
  forecastRolling[tauEvaluationPeriod,2] <- forecastRetail_temp$mean[forecastHorizon]

  # Multivariate model
  modelRetailExo_temp = forecast::Arima(ts_ts(dataeval$df_Retail_sales[1:lastPeriod]),
                                        order = c(0, 0, 1), seasonal=c(2, 1, 0),
                                        xreg = dataeval$df_Retail_EU[1:lastPeriod])
  modelRetaileu_temp <- forecast::Arima(ts_ts(dataeval$df_Retail_EU[1:lastPeriod]), 
                                        order = c(0, 0, 1), seasonal=c(0, 1, 1))
  forecasteu_temp <- forecast::forecast(modelRetaileu_temp, 
                                        h = forecastHorizon)  
  forecastRetail_temp <- forecast::forecast(modelRetailExo_temp,
                                            xreg = forecasteu_temp$mean,
                                            h = forecastHorizon)  
  forecastRolling[tauEvaluationPeriod,3] <- sum(forecastRetail_temp$mean[1:forecastHorizon])    
  
  # Multivariate with Retail EU and CHFEUR 
  
  modelRetailExo_temp = forecast::Arima(ts_ts(dataeval$df_Retail_sales[1:lastPeriod]),
                                        order = c(1, 0, 1), seasonal=c(2, 1, 0),
                                        xreg = cbind(dataeval$df_Retail_EU[1:lastPeriod],
                                                     dataeval$df_CHFEUR[1:lastPeriod]))
  modelRetaileu_temp <- forecast::Arima(ts_ts(dataeval$df_Retail_sales[1:lastPeriod]), 
                                        order = c(0, 0, 1), seasonal=c(0, 1, 1))
  modelCHFEUR_temp <- forecast::Arima(ts_ts(dataeval$df_CHFEUR[1:lastPeriod]), 
                                      order = c(0, 0, 1))
  forecasteu_temp <- forecast::forecast(modelRetaileu_temp, 
                                        h = forecastHorizon)  
  forecastCHFEUR_temp <- forecast::forecast(modelCHFEUR_temp, h = forecastHorizon)
  forecastRetail_temp <- forecast::forecast(modelRetailExo_temp,
                                            xreg = cbind(forecasteu_temp$mean, 
                                                         forecastCHFEUR_temp$mean),
                                            h = forecastHorizon)  
  forecastRolling[tauEvaluationPeriod,4] <- sum(forecastRetail_temp$mean[1:forecastHorizon]) 
  
  # "Naive", no change forecast
  
  forecastRolling[tauEvaluationPeriod,5] <- dataeval$df12_Retail_sales[lastPeriod]
  
  # average - just take the average of different models 
  forecastRolling[tauEvaluationPeriod,6] <- mean(forecastRolling[tauEvaluationPeriod,1:5])

}
Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.Warning: xreg contains different column names from the xreg used in training. Please check that the regressors are in the same order.
matplot(1:70, cbind(forecastRolling,dataeval$df12_Retail_sales[171:240])) 

Now we evaluate the different models according to their performance using the quadratic loss and the absolute loss. Best model is the average of the models, followed by the univarite model. - worst is the naive model.

## Calculate the forecast errors 

actualData <- dataeval$df12_Retail_sales[(length(dataeval$df12_Retail_sales)-tEvaluationPeriods+1):length(dataeval$df12_Retail_sales)]
actualDataMatrix <- kronecker(matrix(1,1,6),actualData)
forecastErrors <- actualDataMatrix - forecastRolling

## Calculate the loss function (quadratic error and absolute error)

quadraticLoss <- forecastErrors^2 
absoluteLoss <- abs(forecastErrors)

## Calculate the mean loss for each model 

colMeans(quadraticLoss[1:70,])*100
[1] 0.03204486 0.03384111 0.03369083 0.05835098 0.05663106 0.03692762
colMeans(absoluteLoss[1:70,])*100
[1] 1.471227 1.513805 1.526135 2.067780 1.843226 1.575969

Check for significance difference between the multivariate with Retail EU and the univariate. The difference is significant with the corrected t-value. It is significant. We might favor the univariate model.

regressionDMW <- lm((quadraticLoss[1:70,1]-quadraticLoss[1:70,3]) ~ 1)
summary(regressionDMW)

Call:
lm(formula = (quadraticLoss[1:70, 1] - quadraticLoss[1:70, 3]) ~ 
    1)

Residuals:
       Min         1Q     Median         3Q        Max 
-3.051e-04 -4.649e-05  5.561e-06  4.856e-05  2.658e-04 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.646e-05  1.246e-05  -1.321    0.191

Residual standard error: 0.0001043 on 69 degrees of freedom
## t-value corrected for autocorrelation 

tHAC <- regressionDMW$coefficients/(NeweyWest(regressionDMW,lag = 12))^0.5
print(tHAC)
            (Intercept)
(Intercept)  -0.6346851

Density forecast multivariate

Model again with the whole timeframe but excluding the pandemic period.

modelretailsales <- forecast::auto.arima(ts_ts(data$df_Retail_sales),
                                         ic="bic",
                                         xreg = cbind(pandemicDummies["2000-02-01/2024-03-01"], 
                                                      data$df_Retail_EU
                                         ),
                                         max.d = 0, 
                                         trace = TRUE,
                                         stepwise = FALSE)

modelretaileu <- forecast::auto.arima(ts_ts(data$df_Retail_EU), 
                                      xreg = pandemicDummies["2000-02-01/2024-03-01"], 
                                      ic = "bic",
                                      trace = TRUE,
                                      stepwise = FALSE
                                      )

Density forecast with random draw from normal distribution of error term

tHorizons <- 12
nDraws <- 100
forecastRetailMatrix <- rbind(kronecker(matrix(1,1,nDraws),data.matrix(data$Retail_sales_cycle)),matrix(NA,tHorizons,nDraws))
forecastEUMatrix <- rbind(kronecker(matrix(1,1,nDraws),data.matrix(data$Retail_EU_cycle)),matrix(NA,tHorizons,nDraws))

pandemicDummiesMatrix <- kronecker(matrix(1,1),pandemicDummies)

T <- length(data$Retail_sales_cycle)
for (tauHorizon in 1:tHorizons) {
  
  for (iDraw in 1:nDraws) {

    modelEU_temp <- Arima(forecastEUMatrix[1:T+tauHorizon-1,iDraw],model = modelretaileu, xreg = pandemicDummiesMatrix[1:T+tauHorizon-1,]) 
    
    meanForecastEU <- forecast::forecast(modelEU_temp,h=1,xreg = matrix(pandemicDummiesMatrix[(T+tauHorizon),],1,24))$mean 
    
    forecastEUMatrix[T+tauHorizon,iDraw] <- meanForecastEU + rnorm(1, mean=0, sd=modelretaileu$sigma2^0.5)
    
    
    modelRetail_temp <- forecast::Arima(forecastRetailMatrix[1:T+tauHorizon-1,iDraw],model = modelretailsales, xreg = cbind(forecastEUMatrix[1:T+tauHorizon-1,iDraw],pandemicDummiesMatrix[1:T+tauHorizon-1,]))
    
    meanForecastRetail <- forecast::forecast(modelRetail_temp,h=1,xreg = cbind(forecastEUMatrix[T+tauHorizon,iDraw],matrix(pandemicDummiesMatrix[(T+tauHorizon),],1,24)))$mean
    forecastRetailMatrix[T+tauHorizon,iDraw] <- meanForecastRetail + rnorm(1, mean=0, sd=modelretailsales$sigma2^0.5)
    
  }
} 

plot(as.ts(data.matrix(data$Retail_sales_cycle)), type = "l", lwd = 2, las = 1, ylab = "",xlim = c(1,T+tHorizons))
fan(data = t(forecastRetailMatrix[(T+1):(T+tHorizons),]), type = "interval", start = (T+1))

Density forecast with ootstrapping

forecastRetailMatrixboot <- rbind(kronecker(matrix(1,1,nDraws),data.matrix(data$Retail_sales_cycle)),matrix(NA,tHorizons,nDraws))
forecastEUMatrixboot <- rbind(kronecker(matrix(1,1,nDraws),data.matrix(data$Retail_EU_cycle)),matrix(NA,tHorizons,nDraws))

modelretaileu$residuals <- modelretaileu$residuals - mean(modelretaileu$residuals)
modelretailsales$residuals <- modelretailsales$residuals - mean(modelretailsales$residuals)

T <- length(data$Retail_sales_cycle)
for (tauHorizon in 1:tHorizons) {
  
  for (iDraw in 1:nDraws) {
    
    modelEU_temp <- Arima(forecastEUMatrix[1:T+tauHorizon-1,iDraw],model = modelretaileu, xreg = pandemicDummiesMatrix[1:T+tauHorizon-1,]) 
    
    meanForecastEU <- forecast::forecast(modelEU_temp,h=1,xreg = matrix(pandemicDummiesMatrix[(T+tauHorizon),],1,24))$mean
    
    forecastEUMatrixboot[T+tauHorizon,iDraw] <- meanForecastEU + modelretaileu$residuals[ceiling(runif(1,0,length(modelretaileu$residuals)))]
    
    
    modelRetail_temp <- forecast::Arima(forecastRetailMatrixboot[1:T+tauHorizon-1,iDraw],model = modelretailsales,xreg =     cbind(forecastEUMatrixboot[1:T+tauHorizon-1,iDraw],pandemicDummiesMatrix[1:T+tauHorizon-1,]))
    
    meanForecastRetail <- forecast::forecast(modelRetail_temp,h=1,xreg = cbind(forecastEUMatrixboot[T+tauHorizon,iDraw],matrix(pandemicDummiesMatrix[(T+tauHorizon),],1,24)))$mean
    forecastRetailMatrixboot[T+tauHorizon,iDraw] <- meanForecastRetail + modelretailsales$residuals[ceiling(runif(1,0,length(modelretailsales$residuals)))]
  }
  
} 

plot(as.ts(data.matrix(data$Retail_sales_cycle)), type = "l", lwd = 2, las = 1, ylab = "",xlim = c(1,T+tHorizons))
fan(data = t(forecastRetailMatrixboot[(T+1):(T+tHorizons),]), type = "interval", start = T+1)

LS0tCnRpdGxlOiAiRm9yZWNhc3QgU3dpc3MgUmV0YWlsIFNhbGVzIEluZGV4IgpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sKLS0tCgojIyMgUHJlbGltaW5hcmllcyAKCmBgYHtyIHNldHVwLCB3YXJuaW5nPUZBTFNFfQojaW5zdGFsbC5wYWNrYWdlcygia25pdHIiKQpsaWJyYXJ5KGtuaXRyKQprbml0cjo6b3B0c19rbml0JHNldChyb290LmRpciA9ICIvVXNlcnMvZmxvcmlhbmdvbGRpbmdlci9EZXNrdG9wL1VuaWx1L0ZvcmVjYXN0aW5nIGluIEVjb25vbWljcyBhbmQgQnVzaW5lc3MvRm9yZWNhc3RpbmcgUHJvamVjdCIpCmtuaXRyOjpvcHRzX2NodW5rJHNldChtZXNzYWdlID0gRkFMU0Usd2FybmluZz1GQUxTRSkKYGBgCgpgYGB7cn0KIHJtKGxpc3QgPSBscygpKQpgYGAKCiMjIyBJbnN0YWxsIGFuZCBsb2FkIHBhY2thZ2VzIAoKYGBge3IsIGNvbW1lbnQ9RkFMU0UsIHdhcm5pbmc9RkFMU0V9CiNpbnN0YWxsLnBhY2thZ2VzKCJ0c2VyaWVzIikgIAojaW5zdGFsbC5wYWNrYWdlcygieHRzIikgCiNpbnN0YW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2llbnQuIApDb21iaW5lZCBSZXRhaWwgRVUgYW5kIENIRi9FVVIgd2l0aCBzaWduaWZpY2FudCBjb2VmZmljaWVudCBmb3IgQ0hGL0VVUiBidXQgbm8gaW1wcm92ZW1lbnQgaW4gQklDLiBXZSBkZWNpZGVkIHRvIG5vdCBpbmNsdWRlIGl0IGluIHRoZSBmb3JlY2FzdCBtb2RlbCBiZWNhdXNlIG9ubHkgbG93IHNpZ25pZmljYW5jZSBhbmQgd2UgcHJlZmVyIGEgc2ltcGxlIG1vZGVsLiAKCmBgYHtyfQpmb3JlY2FzdDo6YXV0by5hcmltYSh0c190cyhkYXRhJGRmX1JldGFpbF9zYWxlcyksCiAgICAgICAgICAgICAgICAgICAgIGljPSJiaWMiLAogICAgICAgICAgICAgICAgICAgICB4cmVnID0gcGFuZGVtaWNEdW1taWVzWyIyMDAwLTAyLTAxLzIwMjQtMDMtMDEiXSwKICAgICAgICAgICAgICAgICAgICAgdHJhY2UgPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICBzdGVwd2lzZSA9IEZBTFNFKQoKZm9yZWNhc3Q6OmF1dG8uYXJpbWEodHNfdHMoZGF0YSRkZl9SZXRhaWxfc2FsZXMpLAogICAgICAgICAgICAgICAgICAgICBpYz0iYmljIiwKICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IGNiaW5kKHBhbmRlbWljRHVtbWllc1siMjAwMC0wMi0wMS8yMDI0LTAzLTAxIl0sIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSRkZl9SZXRhaWxfRVUpLAogICAgICAgICAgICAgICAgICAgICB0cmFjZSA9IFRSVUUsCiAgICAgICAgICAgICAgICAgICAgIHN0ZXB3aXNlID0gRkFMU0UpCgpmb3JlY2FzdDo6YXV0by5hcmltYSh0c190cyhkYXRhJGRmX1JldGFpbF9zYWxlcyksCiAgICAgICAgICAgICAgICAgICAgIGljPSJiaWMiLAogICAgICAgICAgICAgICAgICAgICB4cmVnID0gY2JpbmQocGFuZGVtaWNEdW1taWVzWyIyMDAwLTAyLTAxLzIwMjQtMDMtMDEiXSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhJGRmX1JldGFpbF9FVSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhZyhkYXRhJGRmX1JldGFpbF9FVSkKICAgICAgICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgICAgICAgdHJhY2UgPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICBzdGVwd2lzZSA9IEZBTFNFKQoKZm9yZWNhc3Q6OmF1dG8uYXJpbWEodHNfdHMoZGF0YSRkZl9SZXRhaWxfc2FsZXMpLAogICAgICAgICAgICAgICAgICAgICBpYz0iYmljIiwKICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IGNiaW5kKHBhbmRlbWljRHVtbWllc1siMjAwMC0wMi0wMS8yMDI0LTAzLTAxIl0sIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSRkZl9DSEZFVVIpLAogICAgICAgICAgICAgICAgICAgICB0cmFjZSA9IFRSVUUsCiAgICAgICAgICAgICAgICAgICAgIHN0ZXB3aXNlID0gRkFMU0UpCgpmb3JlY2FzdDo6YXV0by5hcmltYSh0c190cyhkYXRhJGRmX1JldGFpbF9zYWxlcyksCiAgICAgICAgICAgICAgICAgICAgIGljPSJiaWMiLAogICAgICAgICAgICAgICAgICAgICB4cmVnID0gY2JpbmQocGFuZGVtaWNEdW1taWVzWyIyMDAwLTAyLTAxLzIwMjQtMDMtMDEiXSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhJGRmX1JldGFpbF9FVSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEkZGZfQ0hGRVVSKSwKICAgICAgICAgICAgICAgICAgICAgdHJhY2UgPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICBzdGVwd2lzZSA9IEZBTFNFKQoKYGBgCgojIyBNb2Rlb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YW5kZW1pY0R1bW1pZXNbIjIwMDAtMDItMDEvMjAyNC0wMy0wMSJdLCAKICAgICAgICAgICAgICAgICAgICAgdHJhY2UgPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICBzdGVwd2lzZSA9IEZBTFNFKQoKCiMgQ2hlY2sgQVIvTUEgdGVybXMgZm9yIGxhdGVyIHVzZSBpbiB0aGUgZXZhbHVhdGlvbiBwYXJ0IENIRi9FVVIgCmZvcmVjYXN0OjphdXRvLmFyaW1hKGRhdGEkZGZfQ0hGRVVSLAogICAgICAgICAgICAgICAgICAgICBpYz0iYmljIiwKICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IHBhbmRlbWljRHVtbWllc1siMjAwMC0wMi0wMS8yMDI0LTAzLTAxIl0sCiAgICAgICAgICAgICAgICAgICAgIHRyYWNlID0gVFJVRSwKICAgICAgICAgICAgICAgICAgICAgc3RlcHdpc2UgPSBGQUxTRSkKCiMgQ2hlY2sgQVIvTUEgdGVybXMgZm9yIGxhdGVyIHVzZSBpbiB0aGUgZXZhbHVhdGlvbiBwYXJ0IFJldGFpbCBFVSBBTkQgQ0hGL0VVUiAKZm9yZWNhc3Q6OmF1dG8uYXJpbWEodHNfdHMoZGF0YSRkZl9SZXRhaWxfc2FsZXMpLAogICAgICAgICAgICAgICAgICAgICBpYz0iYmljIiwKICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IGNiaW5kKHBhbmRlbWljRHVtbWllc1siMjAwMC0wMi0wMS8yMDI0LTAzLTAxIl0sIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSRkZl9SZXRhaWxfRVUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhJGRmX0NIRkVVUiksCiAgICAgICAgICAgICAgICAgICAgIHRyYWNlID0gVFJVRSwKICAgICAgICAgICAgICAgICAgICAgc3RlcHdpc2UgPSBGQUxTRSkKCmBgYAoKTW9kZWwgYW5kIHBsb3QgZm9yZWNhc3QgZm9yIFJldGFpbCBFVSAKCmBgYHtyfQptb2RlbHJldGFpbGV1IDwtIGZvcmVjYXN0OjphdXRvLmFyaW1hKHRzX3RzKGRhdGEkZGZfUmV0YWlsX0VVKSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IHBhbmRlbWljRHVtbWllc1siMjAwMC0wMi0wMS8yMDI0LTAzLTAxIl0sIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGljID0gImJpYyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2UgPSBUUlVFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZXB3aXNlID0gRkFMU0UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApCgptb2RlbHJldGFpbGV1JGJpYyAgCgpmb3JlY2FzdGV1IDwtIGZvcmVjYXN0Ojpmb3JlY2FzdChtb2RlbHJldGFpbGV1LCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IHBhbmRlbWljRHVtbWllc1siMjAyNC0wNC0wMS8yMDI1LTAzLTAxIl0pCgpwbG90KGZvcmVjYXN0ZXUpCmBgYAoKRm9yZWNhc3QgU3dpc3MgUmV0YWlsIHdpdGggZXhvZ25lb3VzIHZhcmlhYmxlIEV1cm8gUmV0YWlsIAoKYGBge3J9CmZvcmVjYXN0cmV0YWlsIDwtIGZvcmVjYXN0Ojpmb3JlY2FzdChtb2RlbHJldGFpbHNhbGVzLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhyZWcgPSBjYmluZChwYW5kZW1pY0R1bW1pZXNbIjIwMjQtMDQtMDEvMjAyNS0wMy0wMSJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yZWNhc3RldSRtZWFuKSkKCnBsb3QoZm9yZWNhc3RyZXRhaWwpCgpgYGAKClJldmVyc2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gICAgICBvcmRlciA9IGMoMCwgMCwgMSksIHNlYXNvbmFsPWMoMCwgMSwgMSkpCiAgZm9yZWNhc3RldV90ZW1wIDwtIGZvcmVjYXN0Ojpmb3JlY2FzdChtb2RlbFJldGFpbGV1X3RlbXAsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGZvcmVjYXN0SG9yaXpvbikgIAogIGZvcmVjYXN0UmV0YWlsX3RlbXAgPC0gZm9yZWNhc3Q6OmZvcmVjYXN0KG1vZGVsUmV0YWlsRXhvX3RlbXAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeHJlZyA9IGZvcmVjYXN0ZXVfdGVtcCRtZWFuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBmb3JlY2FzdEhvcml6b24pICAKICBmb3JlY2FzdFJvbGxpbmdbdGF1RXZhbHVhdGlvblBlcmlvZCwzXSA8LSBzdW0oZm9yZWNhc3RSZXRhaWxfdGVtcCRtZWFuWzE6Zm9yZWNhc3RIb3Jpem9uXSkgICAgCiAgCiAgIyBNdWx0aXZhcmlhdGUgd2l0aCBSZXRhaWwgRVUgYW5kIENIRkVVUiAKICAKICBtb2RlbFJldGFpbEV4b190ZW1wID0gZm9yZWNhc3Q6OkFyaW1hKHRzX3RzKGRhdGFldmFsJGRmX1JldGFpbF9zYWxlc1sxOmxhc3RQZXJpb2RdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyID0gYygxLCAwLCAxKSwgc2Vhc29uYWw9YygyLCAxLCAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhyZWcgPSBjYmluZChkYXRhZXZhbCRkZl9SZXRhaWxfRVVbMTpsYXN0UGVyaW9kXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhZXZhbCRkZl9DSEZFVV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3Jlc3Npb25ETVckY29lZmZpY2llbnRzLyhOZXdleVdlc3QocmVncmVzc2lvbkRNVyxsYWcgPSAxMikpXjAuNQpwcmludCh0SEFDKQpgYGAKCiMgRGVuc2l0eSBmb3JlY2FzdCBtdWx0aXZhcmlhdGUgCgpNb2RlbCBhZ2FpbiB3aXRoIHRoZSB3aG9sZSB0aW1lZnJhbWUgYnV0IGV4Y2x1ZGluZyB0aGUgcGFuZGVtaWMgcGVyaW9kLiAKCmBgYHtyfQptb2RlbHJldGFpbHNhbGVzIDwtIGZvcmVjYXN0OjphdXRvLmFyaW1hKHRzX3RzKGRhdGEkZGZfUmV0YWlsX3NhbGVzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpYz0iYmljIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4cmVnID0gY2JpbmQocGFuZGVtaWNEdW1taWVzWyIyMDAwLTAyLTAxLzIwMjQtMDMtMDEiXSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEkZGZfUmV0YWlsX0VVCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXguZCA9IDAsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNlID0gVFJVRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGVwd2lzZSA9IEZBTFNFKQoKbW9kZWxyZXRhaWxldSA8LSBmb3JlY2FzdDo6YXV0by5hcmltYSh0c190cyhkYXRhJGRmX1JldGFpbF9FVSksIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhyZWcgPSBwYW5kZW1pY0R1bW1pZXNbIjIwMDAtMDItMDEvMjAyNC0wMy0wMSJdLCAKICAgICAgICAgICAgICAgICAgICAgICAgIC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